using UnityEngine;

namespace IQIGame.Onigao.GamePlay
{
    public partial class UIMapManager
    {
        private class UIPortalMapSymbol : UINormalMapSymbol
        {
            protected UIMsgDispatcher uiMsgDispatcher => this._msgDispatcher as UIMsgDispatcher;

            protected override void AddMsgListeners()
            {
                uiMsgDispatcher.AddListener<int, bool>(MsgEventType.Level_NotifyActiveCheckPoint,
                        OnNotifyActiveCheckPoint);
            }

            public override void Reset()
            {
                base.Reset();
            }

            private void OnNotifyActiveCheckPoint(int entityId, bool active)
            {
                if (data.entityId != entityId)
                {
                    return;
                }
                ui.icon.color = active ? Color.white : Color.gray;
            }

            protected override void Draw()
            {
                base.Draw();
                ui.icon.color = data.isCheckPointActive ? Color.white : Color.gray;
            }
        }
    }
}